import java.util.Arrays;

public class J811 {
    public static boolean hhh(int[] arr) {
        int mounth = 0;
        for (int i = 0; i < arr.length; i++) {
            if (arr[i] % 2 != 0) {
                mounth++;
                if (mounth == 3) {
                    return true;
                }
            }else {
                mounth = 0;
            }

        }
        return false;
    }
    public static void main6(String[] args) {
        int[] arr = {2,6,4,2,3,5,9,1};
        boolean flg = hhh(arr);
        System.out.println(flg);

    }
    public static int bbb(int[] array3) {
        Arrays.sort(array3);//数组排序
        return array3[array3.length/2];

    }
    public static void main5(String[] args) {
        int[] array3 = {1,2,2};
        int jjj = bbb(array3);
        System.out.println(jjj);
    }
    public static int nnn(int[] array2) {
        int ret = 0;
        for (int i = 0; i < array2.length;i++){
            ret ^= array2[i];
        }
        return ret;
    }
    public static void main4(String[] args) {
        int[] array2 = {2,2,3,3,4};
        int mmm = nnn(array2);
        System.out.println(mmm);

    }
    public static int[] func2(int[] nums,int target){
        int[] tem = {-1,-1};
        for (int i = 0; i < nums.length; i++) {
            for(int j = i + 1;j < nums.length;j++){
                if (nums[i] + nums[j] == target){
                    tem[0] = i;
                    tem[1] = j;
                }
            }
        }
        return tem;
    }
    public static void main3(String[] args) {
        int[] nums = {2,5,4,6,8};
        int[] ret1=func2(nums,10);
        System.out.println(Arrays.toString(ret1));
    }
    public static void func(int[] array1,int i,int j){
        int mum = array1[i];
        array1[i] = array1[j];
        array1[j] = mum;
    }
    public static void func1(int[] array1){
        //int[] ret1 = array1;
        int i = 0;
        int j = array1.length-1;

        while(i < j){
            if (array1[i] % 2 != 0) {
                i++;
            }
            if (array1[j] % 2 == 0) {
                j--;
            }
            if (array1[i] % 2 == 0 && array1[j] % 2 != 0) {
                func(array1, i, j);
            }
        }
        //return ret1;
    }
    public static void main2(String[] args) {
        int[] array1 = {1, 6, 5, 4, 8, 3, 7};
        func1(array1);
        //int[] num = func1(array1);
        System.out.println(Arrays.toString(array1));
    }
    public static int[] transform(int[] array) {
        int[] ret = array;
        for (int i = 0; i < array.length; i++) {
            ret[i] = ret[i] * 2;

        }
        return ret;
    }
    public static void main1(String[] args) {
        int[] array = {1,2,3};
        int[] ret1 = transform(array);
        System.out.println(Arrays.toString(ret1));
    }
}
